package com.example.mydefinedview1.ui

import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.util.AttributeSet
import android.view.View

/**
 * @Author： LJH
 * @Time： 2022/6/29
 * @description：
 */
class RectView(context: Context, attr:AttributeSet?):View(context,attr) {
    private val paint = Paint()
    override fun onDraw(canvas: Canvas?) {
        super.onDraw(canvas)
        //练习内容：使用 canvas.drawRect() 方法画矩形
        paint.color = Color.BLACK
        paint.style = Paint.Style.FILL
        canvas?.drawRect(260F,100F,460F,300F,paint)
    }
}